package controller.member ;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import Bean.memberBean;
import dao.memberDao;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;


public class idCheckController implements Controller{
	private memberDao dao;

	public void setDao(memberDao dao) { this.dao = dao;	}
	
	@Override
	public ModelAndView handleRequest(HttpServletRequest request,
			HttpServletResponse arg1) throws Exception {
		String comment="";
	
		String mid = request.getParameter("mid");
		String mpassword="";
		mpassword = request.getParameter("mpassword");
		
		if(mpassword.equals("")){
			mpassword="o";
		}
		
		System.out.println("findController:mid = " + mid);
		System.out.println(mpassword+" dd");
		int result = dao.mCheckid(mid,mpassword);
		
		if(result==-1){
			comment="<font color='blue'>사용가능아이디</font>";
		}else{
			comment="<font color='red'>사용중인 아이디</font>";
		}
		System.out.println(comment+" 여기는 con");
		return new ModelAndView("IdCheck", "comment", comment);
		
	}	
}